//
//  UIView+PYSnap.m
//  catuncel
//
//  Created by Jim on 2017/12/6.
//  Copyright © 2017年 Jim. All rights reserved.
//

#import "UIView+PYSnap.h"

@implementation UIView (PYSnap)

- (UIImage *)snapToImage
{
    UIGraphicsBeginImageContextWithOptions(self.bounds.size,YES,0);
    
    [self drawViewHierarchyInRect:self.bounds afterScreenUpdates:YES];
    
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    
    UIGraphicsEndImageContext();
    
    return image;  
}

@end
